gtkcssshadowvalue: Use cairo_surface_create_similar_image
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 2 Sep 2014 18:21:02 +0000 (11:21 -0700)
committerJasper St. Pierre <jstpierre@mecheye.net>
Tue, 2 Sep 2014 18:26:55 +0000 (11:26 -0700)
Calling this on an Xlib surface allows us to keep this in SHM memory,
giving it a potential speedup so we don't have to copy it to SHM memory
for the Composite when we mask later.

gtk/gtkcssshadowvalue.c

index 671f4f0b6d2abbcceb9dcf3132053ad80c140d6b..7f72698df2651023ac97e8b85b286d1c3fd98b97 100644 (file)
@@ -331,9 +331,10 @@ gtk_css_shadow_value_start_drawing (const GtkCssValue *shadow,
   clip_radius = _gtk_cairo_blur_compute_pixels (radius);
 
   /* Create a larger surface to center the blur. */
-  surface = cairo_image_surface_create (CAIRO_FORMAT_A8,
-                                        clip_rect.width + 2 * clip_radius,
-                                        clip_rect.height + 2 * clip_radius);
+  surface = cairo_surface_create_similar_image (cairo_get_target (cr),
+                                                CAIRO_FORMAT_A8,
+                                                clip_rect.width + 2 * clip_radius,
+                                                clip_rect.height + 2 * clip_radius);
   cairo_surface_set_device_offset (surface, clip_radius - clip_rect.x, clip_radius - clip_rect.y);
   blur_cr = cairo_create (surface);
   cairo_set_user_data (blur_cr, &shadow_key, cairo_reference (cr), (cairo_destroy_func_t) cairo_destroy);